package pacman.entries.pacman.ml.features;

import pacman.game.Game;
import pacman.game.Constants.GHOST;
import pacman.game.Constants.MOVE;

public class DistanceToGhostFeature extends FeatureExtractor {
	private GHOST target;
	public DistanceToGhostFeature(float ghost) {
		target = GHOST.values()[(int)ghost];
	}
	public float Extract(Game game) {
		int fromNodeIndex = game.getGhostCurrentNodeIndex(target);
		int toNodeIndex = game.getPacmanCurrentNodeIndex();
		MOVE lastMoveMade = game.getGhostLastMoveMade(target);
		return FeatureExtractor.FeatureDistance(-game.getShortestPathDistance(fromNodeIndex,
													toNodeIndex,lastMoveMade));
	}
}